﻿#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <list>
#include "../NetEngine_SourceCode/XyRyNet_CommHdr.h"
#include "../NetEngine_SourceCode/XyRyNet_Types.h"
#include "../NetEngine_SourceCode/XyRyNet_ProtocolHdr.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_PublicLib/NetOperator_Define.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_PublicLib/NetOperator_Error.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_PublicLib/Algorithm_Define.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_PublicLib/Algorithm_Error.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_Core/ManagePool_Define.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_Core/ManagePool_Define.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_Core/NetCore_Define.h"
#include "../NetEngine_Release/NetEngine_Include/NetEngine_Core/NetCore_Error.h"

//g++ -std=gnu++11 -Wall -g TestSctp_Srv.cpp -o TestSctp_Srv -L ../NetEngine_Release/NetEngine_Release/NetEngine_PublicLib -L ../NetEngine_Release/NetEngine_Release/NetEngine_Core -lNetEngine_BaseLib -lNetEngine_Algorithm -lNetEngine_Core -lNetEngine_ManagePool -Wl,-rpath=./:../NetEngine_Release/NetEngine_Release/NetEngine_PublicLib:../NetEngine_Release/NetEngine_Release/NetEngine_Core




void NetSctp_CBLogin(LPCTSTR lpszClientAddr,LPVOID lParam)
{
    printf("NetSctp_CBLogin:%s\n",lpszClientAddr);
}
void NetSctp_CBRecv(LPCTSTR lpszClientAddr,LPCTSTR lpszRecvMsg,int nMsgLen,int nChannel,LPVOID lParam)
{
    printf("NetSctp_CBRecv:%s,%s,%d,%d\n",lpszClientAddr,lpszRecvMsg,nMsgLen,nChannel);
}
void NetSctp_CBLeave(LPCTSTR lpszClientAddr,LPVOID lParam)
{
    printf("NetSctp_CBLeave:%s\n",lpszClientAddr);
}

int main()
{
    XNETHANDLE xhNet;
    ManagePool_GetLastError();
    NetEngine_Algorithm_GetLastError();
    NetEngine_OperatorHandle_Create(&xhNet);

    if (!NetCore_SCTP_Start())
    {
        printf("%lX\n",NetCore_GetLastError());
    }
    NetCore_SCTP_RegisterCallBack(NetSctp_CBLogin,NetSctp_CBRecv,NetSctp_CBLeave);
    printf("启动成功\n");
    do{
         sleep(10);
    }while(1);
    return 0;
}
